This scenario requires a report that already contains a group which also must contain a summary field.
A Group Sort Field can only exist if the group contains a summary field, because that summary field is what the Sort is based on. In this example, the report is grouped on {Customer.Region} and the summary field is the "SUM of Customer.Last Year's Sales (Currency)".
To add a group sort field you can use code similar to the following:
Dim CRXReport As New CrystalReport1 'The existing report (ActiveX Designer) Dim CRXSortFields As CRAXDRT.SortFields Dim CRXSummaryField As CRAXDRT.SummaryFieldDefinition
Private Sub Form_Load()
Set CRXCRXSortFields = CRXReport.GroupSortFields
Set CRXSummaryField = CRXReport.SummaryFields.Item(1)
CRXSortFields.Add CRXSummaryField, crDescendingOrder
CRViewer1.ReportSource = CRXReport CRViewer1.ViewReport
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |